<template>
	<view v-if="!isLoading" class="container">
		<view v-if="applyStatus > 0">
			
		</view>
		<!-- 正在审核中 -->
		<view class="no-dealer" v-else-if="applyStatus == 10">
			<view class="no-icon">
				<image src="@/static/not-dealer.png"></image>
			</view>
			<view class="no-msg">嘻嘻嘻嘻嘻嘻</view>
			<!-- 立即申请 -->
			<view class="no-submit">
				<view class="button">生生世世是</view>
			</view>
		</view>
	</view>

</template>

<script>

	import { Dealer } from '@/utils/model/dealer-model.js';
	var dealer = new Dealer();

	export default {
		data() {
			return {
				// 正在加载
				isLoading: true,
				// 当前用户信息
				user: undefined,
				// 当前申请状态 审核中 审核通过 驳回
				applyStatus: -1,
				// 当前分销商信息
				dealer: undefined,
				// 推荐人昵称
				refereeName: undefined,
				// 分销设置
				setting: {
					background: undefined,
					words: undefined
				}
			}
		},

		onShow(options) {
			this.getCenter()
		},

		methods: {

		  // 获取分销商中心数据
		  getCenter() {
			const app = this
			app.isLoading = true
			dealer.getCenter().then(res => {
				if(res.code == 1){
					app.isDealer = res.data.isDealer
					app.dealer = res.data.dealer
				}
				 app.isLoading = false
			}).catch(err => {
				console.log(err)
			})
			
			/* Api.center()
			  .then(result => {
				// api数据赋值
				const data = result.data
				app.isDealer = data.isDealer
				app.user = data.user
				app.dealer = data.dealer
				app.refereeName = data.refereeName
				app.setting = data.setting
				// 设置当前页面标题
				app.setPageTitle()
				app.isLoading = false
			  }) */
		  },

		  // 设置当前页面标题
		  /* setPageTitle() {
			uni.setNavigationBarTitle({
			  title: this.setting.words.index.title.value
			})
		  } */

		}
	}
</script>


<style>
  page {
    background: #fff;
  }
</style>
<style scoped lang="scss">
	@import '~@/pages/dealer/index.scss';
</style>
